@extends('adminHead')
@section('title','四维金科后台管理系统')
@section('rightContent')
    <!-- ============================================================== -->
    <!-- Start right Content here -->
    <!-- ============================================================== -->
    <div class="content-page">
        <!-- Start content -->
        <div class="content">
            <div class="container">

                <!-- Page-Title -->
                <div class="row">
                    <div class="col-sm-12">
                        <h4 class="page-title">后台管理系统</h4>
                        <ol class="breadcrumb">
                            <li>
                                <a href="/admin/index">首页</a>
                            </li>
                            <li>
                                <a href="/admin/listInfo">保单信息查看</a>
                            </li>
                            <li class="active">
                                保单信息查看
                            </li>
                        </ol>
                    </div>
                </div>
                <!--Custom Toolbar-->
                <!--===================================================-->
                <div class="panel">
                    @if (count($errors) > 0)
                        <div class="alert alert-danger">
                            <ul>
                                @foreach ($errors->all() as $error)
                                    <li>{{ $error }}</li>
                                @endforeach
                            </ul>
                        </div>
                    @endif
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-sm-6">
                                <div class="m-b-30">
                                    <a href="/admin/companySettingsAdd" id="addToTable" class="btn btn-default waves-effect waves-light">配置 <i class="fa fa-plus"></i></a>
                                </div>
                            </div>
                        </div>

                        <div class="">
                            <table id="table"
                                   class="table-bordered">
                                <thead>
                                <tr>
                                    <th data-field="id">ID</th>
                                    <th data-field="number">保单号</th>
                                    <th data-field="license_plate_number">车牌号</th>
                                    <th data-field="policy_holder">投保人</th>
                                    <th data-field="insured">被保人</th>
                                    <th data-field="cname">公司名称</th>
                                    <th data-field="compulsory_insurance">交强险保费</th>
                                    <th data-field="j_processing_fee_ratio">交强手续费比例</th>
                                    <th data-field="j_service_charge">交强手续费金额</th>
                                    <th data-field="">商业险保费</th>
                                    <th data-field="s_processing_fee_ratio">商业险手续费比例</th>
                                    <th data-field="s_service_charge">商业险手续费金额</th>
                                    <th data-field="vehicles_vessels">车船税</th>
                                    <th data-field="j_application_fee">交强险申请费用</th>
                                    <th data-field="c_application_fee">车船税申请费用</th>
                                    <th data-field="s_application_fee">商业险申请费用</th>
                                    <th data-field="total_cost">合计费用</th>
                                </tr>
                                </thead>
                                <tbody>

                                </tbody>
                            </table>
                        </div>
                    </div>
                    <!-- end: page -->

                </div> <!-- end Panel -->


            </div> <!-- container -->

        </div> <!-- content -->

        <footer class="footer">
            2019 © 慧盈
        </footer>

    </div>
    <div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h4 class="modal-title" id="myModalLabel">重置密码成功</h4>
                </div>
                <div class="modal-body">
                    <p></p>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default waves-effect" data-dismiss="modal">确定</button>
                    {{--<button type="button" class="btn btn-primary waves-effect waves-light">确定</button>--}}
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div>
    <!-- ============================================================== -->
    <!-- End Right content here -->
    <!-- ============================================================== -->


    <!-- Right Sidebar -->
    <div class="side-bar right-bar nicescroll">
        <h4 class="text-center">Chat</h4>
        <div class="contact-list nicescroll">
            <ul class="list-group contacts-list">
                <li class="list-group-item">
                    <a href="#">
                        <div class="avatar">
                            <img src="/admin/assets/images/users/avatar-1.jpg" alt="">
                        </div>
                        <span class="name">Chadengle</span>
                        <i class="fa fa-circle online"></i>
                    </a>
                    <span class="clearfix"></span>
                </li>
                <li class="list-group-item">
                    <a href="#">
                        <div class="avatar">
                            <img src="/admin/assets/images/users/avatar-2.jpg" alt="">
                        </div>
                        <span class="name">Tomaslau</span>
                        <i class="fa fa-circle online"></i>
                    </a>
                    <span class="clearfix"></span>
                </li>
                <li class="list-group-item">
                    <a href="#">
                        <div class="avatar">
                            <img src="/admin/assets/images/users/avatar-3.jpg" alt="">
                        </div>
                        <span class="name">Stillnotdavid</span>
                        <i class="fa fa-circle online"></i>
                    </a>
                    <span class="clearfix"></span>
                </li>
                <li class="list-group-item">
                    <a href="#">
                        <div class="avatar">
                            <img src="/admin/assets/images/users/avatar-4.jpg" alt="">
                        </div>
                        <span class="name">Kurafire</span>
                        <i class="fa fa-circle online"></i>
                    </a>
                    <span class="clearfix"></span>
                </li>
                <li class="list-group-item">
                    <a href="#">
                        <div class="avatar">
                            <img src="/admin/assets/images/users/avatar-5.jpg" alt="">
                        </div>
                        <span class="name">Shahedk</span>
                        <i class="fa fa-circle away"></i>
                    </a>
                    <span class="clearfix"></span>
                </li>
                <li class="list-group-item">
                    <a href="#">
                        <div class="avatar">
                            <img src="/admin/assets/images/users/avatar-6.jpg" alt="">
                        </div>
                        <span class="name">Adhamdannaway</span>
                        <i class="fa fa-circle away"></i>
                    </a>
                    <span class="clearfix"></span>
                </li>
                <li class="list-group-item">
                    <a href="#">
                        <div class="avatar">
                            <img src="/admin/assets/images/users/avatar-7.jpg" alt="">
                        </div>
                        <span class="name">Ok</span>
                        <i class="fa fa-circle away"></i>
                    </a>
                    <span class="clearfix"></span>
                </li>
                <li class="list-group-item">
                    <a href="#">
                        <div class="avatar">
                            <img src="/admin/assets/images/users/avatar-8.jpg" alt="">
                        </div>
                        <span class="name">Arashasghari</span>
                        <i class="fa fa-circle offline"></i>
                    </a>
                    <span class="clearfix"></span>
                </li>
                <li class="list-group-item">
                    <a href="#">
                        <div class="avatar">
                            <img src="/admin/assets/images/users/avatar-9.jpg" alt="">
                        </div>
                        <span class="name">Joshaustin</span>
                        <i class="fa fa-circle offline"></i>
                    </a>
                    <span class="clearfix"></span>
                </li>
                <li class="list-group-item">
                    <a href="#">
                        <div class="avatar">
                            <img src="/admin/assets/images/users/avatar-10.jpg" alt="">
                        </div>
                        <span class="name">Sortino</span>
                        <i class="fa fa-circle offline"></i>
                    </a>
                    <span class="clearfix"></span>
                </li>
            </ul>
        </div>
    </div>
    <script>
      var resizefunc = [];
    </script>

    <script src="{{URL::asset('./admin/assets/js/jquery.min.js')}}"></script>
    <script src="{{URL::asset('./admin/assets/js/bootstrap.min.js')}}"></script>
    <script src="{{URL::asset('./admin/assets/js/detect.js')}}"></script>
    <script src="{{URL::asset('./admin/assets/js/fastclick.js')}}"></script>
    <script src="{{URL::asset('./admin/assets/js/jquery.slimscroll.js')}}"></script>
    <script src="{{URL::asset('./admin/assets/js/jquery.blockUI.js')}}"></script>
    <script src="{{URL::asset('./admin/assets/js/waves.js')}}"></script>
    <script src="{{URL::asset('./admin/assets/js/wow.min.js')}}"></script>
    <script src="{{URL::asset('./admin/assets/js/jquery.nicescroll.js')}}"></script>
    <script src="{{URL::asset('./admin/assets/js/jquery.scrollTo.min.js')}}"></script>
    <script src="{{URL::asset('./admin/assets/plugins/datatables/jquery.dataTables.min.js')}}"></script>
    <script src="/admin/assets/plugins/bootstrap-table/dist/bootstrap-table.min.js"></script>


    <script src="https://cdn.bootcss.com/bootstrap-table/1.13.1/bootstrap-table.min.js"></script>
    <script src="https://cdn.bootcss.com/bootstrap-table/1.13.1/extensions/export/bootstrap-table-export.min.js"></script>
    <script src="https://cdn.bootcss.com/xlsx/0.14.1/xlsx.core.min.js"></script>
    <script src="https://cdn.bootcss.com/FileSaver.js/2014-11-29/FileSaver.min.js"></script>
    <script src="/admin/assets/js/tableExport.min.js"></script>


    <script src="https://cdn.bootcss.com/jquery-confirm/3.3.2/jquery-confirm.min.js"></script>
    <script src="{{URL::asset('./admin/assets/js/jquery.core.js')}}"></script>
    <script src="{{URL::asset('./admin/assets/js/jquery.app.js')}}"></script>

    <script>
        $(function () {
          $(document).ready(function() {
            $('#datatable').dataTable({
              'language':{
                url:'/json/datatable_en.json'
              }
            });
          } );
          $("#table").bootstrapTable({
            url:'/admin/getInfoList',
            dataType:'json',
            method:'get',
            showExport: true,
            exportDataType: 'all',
            showColumns:true,
            pagination:true,
            sortName:'created_at',
            sortOrder:"desc",
            pageSize:"100",
            checkbox:true,
            pageList:"[100, 150, 200,All]",
            search:true,
            smartDisplay:true,
            exportTypes:['xlsx'],
            columns:[]
          });
          $("body").delegate(".reset_password",'click',function () {
            var ids = $(this).data('id');
            if(ids == 1){
              $(".modal-body p").html('无法重置超级管理员密码！');
              $('#myModal').modal('show')
              return false;
            }
            $.confirm({
              title: '重置密码',
              content: '确定重置密码？',
              type: 'green',
              icon: 'glyphicon glyphicon-question-sign',
              buttons: {
                ok: {
                  text: '确认',
                  btnClass: 'btn-primary',
                  action: function() {
                    $.get('/admin/resetPassword',{id:ids},function (res) {
                      res = JSON.parse(res);
                      var str = '';
                      if(res.status == 1){
                        str = '重置密码成功，请复制紧记密码：'+res.info;
                      }else{
                        str = '重置密码失败，请检查网络稍后再试！';
                      }
                      $(".modal-body p").html(str);
                      $('#myModal').modal('show')
                    })
                  }
                },
                cancel: {
                  text: '取消',
                  btnClass: 'btn-primary'
                }
              }
            });
          })
            $(".adminDelete").on('click',function () {
              console.log('aa')
              var $id = $(this).data('id');
          $.confirm({
            title: '删除员工',
            content: '确定删除账户？',
            type: 'green',
            icon: 'glyphicon glyphicon-question-sign',
            buttons: {
              ok: {
                text: '确认',
                btnClass: 'btn-primary',
                action: function() {
                  $.get('/admin/adminDelete', {id: $id}, function (res) {
                    console.log(res)
                    location.reload()
                  })
                }
              },
              cancel: {
                text: '取消',
                btnClass: 'btn-primary'
              }
            }
            });
        })
          $("body").delegate(".save_state",'click',function () {
            var $id = $(this).data('id');
            var type = $(this).data('state');
            var content = '确定要禁止账号吗？';
            if(type == 0){
              content = '确定要开启账号吗？';
            }
            console.log('a')
            var _this = this;
            $.confirm({
              title: 'Delete',
              content: content,
              type: 'green',
              icon: 'glyphicon glyphicon-question-sign',
              buttons: {
                ok: {
                  text: '确认',
                  btnClass: 'btn-primary',
                  action: function() {
                    $.get('/admin/adminSaveState', {id: $id,type:type}, function (res) {
                      res = JSON.parse(res);
                      alert(res.info);
                      if(res.status == 1){
                        if(type == 1){
                            $(_this).removeClass('glyphicon-ok')
                            $(_this).addClass('glyphicon-remove')
                        }else{
                          $(_this).removeClass('glyphicon-remove')
                          $(_this).addClass('glyphicon-ok')
                        }
                      }
                    })
                  }
                },
                cancel: {
                  text: '取消',
                  btnClass: 'btn-primary'
                }
              }
            });
          })
        });
    </script>


    @endsection



